<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" xmlns:formvh="http://typo3.org/ns/TYPO3/CMS/Form/ViewHelpers" data-namespace-typo3-fluid="true">
<f:layout name="FormManager" />
<f:section name="MainContent">

    <script>
        require(['{dynamicRequireJsModules.app}', '{dynamicRequireJsModules.viewModel}'], function (formManagerApp, viewModel) {
            var FORMMANAGER_APP = formManagerApp.getInstance(
                <f:format.htmlentitiesDecode>{formManagerAppInitialData}</f:format.htmlentitiesDecode>,
                viewModel
            ).run();
        });
    </script>
    <h1><f:translate key="LLL:EXT:form/Resources/Private/Language/Database.xlf:formManager.headline" /></h1>
    <f:if condition="{forms}">
        <f:then>
            <div class="panel panel-space panel-default recordlist">
                <div class="panel-heading">
                    <span><f:translate key="LLL:EXT:form/Resources/Private/Language/Database.xlf:formManager.edit_existing_forms" /></span>
                </div>
                <div class="collapse in">
                    <div class="table-fit">
                        <table id="forms" class="table table-striped table-hover">
                            <thead>
                                <tr>
                                    <th class="col-icon nowrap"><a class="btn btn-default" data-identifier="newForm" title="{f:translate(key: 'LLL:EXT:form/Resources/Private/Language/Database.xlf:formManager.create_new_form')}" href="#"><core:icon identifier="actions-add" /></a></th>
                                    <th class="col-title col-responsive nowrap"><f:translate key="LLL:EXT:form/Resources/Private/Language/Database.xlf:formManager.form_name" /></th>
                                    <th class="col-control nowrap"></th>
                                    <th class="nowrap"><f:translate key="LLL:EXT:form/Resources/Private/Language/Database.xlf:formManager.location" /></th>
                                    <th class="nowrap"><f:translate key="LLL:EXT:form/Resources/Private/Language/Database.xlf:formManager.references" /></th>
                                </tr>
                            </thead>
                            <tbody>
                            <f:for each="{forms}" as="form">
                                <tr>
                                    <td class="col-icon nowrap">
                                        <f:if condition="{form.invalid}">
                                            <f:then>
                                                <span title="{f:translate(key: 'LLL:EXT:form/Resources/Private/Language/Database.xlf:formManager.invalid')}" data-toggle="tooltip" data-placement="top">
                                                    <core:icon identifier="overlay-missing" />
                                                </span>
                                            </f:then>
                                            <f:else if="{form.duplicateIdentifier}">
                                                <span title="{f:translate(key: 'LLL:EXT:form/Resources/Private/Language/Database.xlf:formManager.duplicate_identifier')} {form.identifier}" data-toggle="tooltip" data-placement="top">
                                                    <core:icon identifier="overlay-missing" />
                                                </span>
                                            </f:else>
                                            <f:else>
                                                <span title="id={form.identifier}" data-toggle="tooltip" data-placement="right">
                                                    <core:icon identifier="content-form" />
                                                </span>
                                            </f:else>
                                        </f:if>
                                    </td>
                                    <td class="col-title col-responsive nowrap">
                                        <f:if condition="{form.invalid} || {form.readOnly}">
                                                <f:then>
                                                    <div title="{form.name}">{form.name}</div>
                                                </f:then>
                                                <f:else>
                                                    <f:link.action controller="FormEditor" action="index" arguments="{formPersistenceIdentifier: form.persistenceIdentifier}" title="{f:translate(key: 'LLL:EXT:form/Resources/Private/Language/Database.xlf:formManager.edit_form')}" data="{toggle: 'tooltip', placement: 'right'}">{form.name}</f:link.action>
                                                </f:else>
                                        </f:if>
                                    </td>
                                    <td class="col-control nowrap">
                                        <div class="btn-group" role="group">
                                            <f:if condition="{form.invalid} || {form.readOnly}">
                                                <f:then>
                                                    <button class="btn btn-default form-record-readonly" disabled="disabled" title="{f:translate(key: 'LLL:EXT:form/Resources/Private/Language/Database.xlf:formManager.edit_form_not_allowed')}"><core:icon identifier="actions-open" /></button>
                                                </f:then>
                                                <f:else>
                                                    <f:link.action controller="FormEditor" action="index" arguments="{formPersistenceIdentifier: form.persistenceIdentifier}" title="{f:translate(key: 'LLL:EXT:form/Resources/Private/Language/Database.xlf:formManager.edit_form')}" class="btn btn-default form-record-open"><core:icon identifier="actions-open" /></f:link.action>
                                                </f:else>
                                            </f:if>
                                            <f:if condition="{form.invalid}">
                                                <f:then>
                                                    <button class="btn btn-default form-record-readonly" disabled="disabled" title="{f:translate(key: 'LLL:EXT:form/Resources/Private/Language/Database.xlf:formManager.duplicate_form_not_allowed')}"><core:icon identifier="actions-duplicate" /></button>
                                                    <button class="btn btn-default form-record-readonly" disabled="disabled" title="{f:translate(key: 'LLL:EXT:form/Resources/Private/Language/Database.xlf:formManager.delete_form_not_allowed')}"><core:icon identifier="actions-edit-delete" /></button>
                                                </f:then>
                                                <f:else>
                                                    <a href="#" data-identifier="duplicateForm" data-form-persistence-identifier="{form.persistenceIdentifier}" data-form-name="{form.name}" title="{f:translate(key: 'LLL:EXT:form/Resources/Private/Language/Database.xlf:formManager.duplicate_this_form')}" class="btn btn-default form-record-duplicate"><core:icon identifier="actions-duplicate" /></a>
                                                    <f:if condition="{form.removable}">
                                                        <f:then>
                                                            <a href="#" data-identifier="removeForm" data-form-persistence-identifier="{form.persistenceIdentifier}" title="{f:translate(key: 'LLL:EXT:form/Resources/Private/Language/Database.xlf:formManager.delete_form')}" class="btn btn-default form-record-delete"><core:icon identifier="actions-edit-delete" /></a>
                                                        </f:then>
                                                        <f:else>
                                                            <button class="btn btn-default form-record-delete" disabled="disabled" title="{f:translate(key: 'LLL:EXT:form/Resources/Private/Language/Database.xlf:formManager.delete_form_not_allowed')}"><core:icon identifier="actions-edit-delete" /></button>
                                                        </f:else>
                                                    </f:if>
                                                </f:else>
                                            </f:if>
                                        </div>
                                    </td>
                                    <td class="nowrap">{form.persistenceIdentifier}</td>
                                    <td class="nowrap">
                                        <f:if condition="{form.referenceCount}">
                                            <f:then>
                                                <a href="#" data-identifier="showReferences" data-form-persistence-identifier="{form.persistenceIdentifier}" data-form-name="{form.name}">{form.referenceCount}</a>
                                            </f:then>
                                            <f:else>
                                                {form.referenceCount}
                                            </f:else>
                                        </f:if>
                                    </td>
                                </tr>
                            </f:for>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </f:then>
    <f:else>
        <f:be.infobox state="-1" title="{f:translate(key: 'LLL:EXT:form/Resources/Private/Language/Database.xlf:formManager.forms_not_found.title')}">
            <p><f:translate key="LLL:EXT:form/Resources/Private/Language/Database.xlf:formManager.forms_not_found.message" /></p>
            <a class="btn btn-primary" href="#" data-identifier="newForm"><f:translate key="LLL:EXT:form/Resources/Private/Language/Database.xlf:formManager.create_new_form" /></a>
        </f:be.infobox>
    </f:else>
</f:if>

</f:section>
</html>
